import redis
from rediscluster import RedisCluster

# 配置Redis集群节点
startup_nodes = [
    {"host": "10.10.7.64", "port": "7003"},
    {"host": "10.10.4.123", "port": "7003"},
    {"host": "10.10.2.100", "port": "7003"},
    {"host": "10.10.7.64", "port": "7004"},
    {"host": "10.10.4.123", "port": "7004"},
    {"host": "10.10.2.100", "port": "7004"}
]

# 密码
password = "EfyyS3ap"

# 连接
rc = RedisCluster(startup_nodes=startup_nodes, decode_responses=True, password=password)

# 要删除的key
key = {
    "my_key"
}

# 删除指定的key
for i in key:
    rc.delete(i)
    print(f"Key {key} deleted successfully.")